package com.huohuzhihui.merchant.service.impl;

import java.util.List;

import com.huohuzhihui.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.huohuzhihui.merchant.mapper.AgentCostMapper;
import com.huohuzhihui.merchant.domain.AgentCost;
import com.huohuzhihui.merchant.service.IAgentCostService;

/**
 * 消费记录Service业务层处理
 *
 * @author huohuzhihui
 * @date 2021-06-04
 */
@Service
public class AgentCostServiceImpl implements IAgentCostService {
    @Autowired
    private AgentCostMapper agentCostMapper;

    /**
     * 查询消费记录
     *
     * @param id 消费记录ID
     * @return 消费记录
     */
    @Override
    public AgentCost selectAgentCostById(Long id) {
        return agentCostMapper.selectAgentCostById(id);
    }

    /**
     * 查询消费记录列表
     *
     * @param agentCost 消费记录
     * @return 消费记录
     */
    @Override
    public List<AgentCost> selectAgentCostList(AgentCost agentCost) {
        return agentCostMapper.selectAgentCostList(agentCost);
    }

    /**
     * 新增消费记录
     *
     * @param agentCost 消费记录
     * @return 结果
     */
    @Override
    public int insertAgentCost(AgentCost agentCost) {
        agentCost.setCreateTime(DateUtils.getNowDate());
        return agentCostMapper.insertAgentCost(agentCost);
    }

    /**
     * 修改消费记录
     *
     * @param agentCost 消费记录
     * @return 结果
     */
    @Override
    public int updateAgentCost(AgentCost agentCost) {
        return agentCostMapper.updateAgentCost(agentCost);
    }

    /**
     * 批量删除消费记录
     *
     * @param ids 需要删除的消费记录ID
     * @return 结果
     */
    @Override
    public int deleteAgentCostByIds(Long[] ids) {
        return agentCostMapper.deleteAgentCostByIds(ids);
    }

    /**
     * 删除消费记录信息
     *
     * @param id 消费记录ID
     * @return 结果
     */
    @Override
    public int deleteAgentCostById(Long id) {
        return agentCostMapper.deleteAgentCostById(id);
    }

    @Override
    public long getCostCount(Long deptId) {
        return agentCostMapper.getCostCount(deptId);
    }
}
